package com.example.demodb.service;

import com.example.demodb.entity.UserLove;
import com.example.demodb.repository.IUserLoveRepository;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserLoveService { //service可以抽象成接口
    @Resource
    private IUserLoveRepository userLoveRepository;
    public void update(UserLove userLove){
        userLoveRepository.save(userLove);//覆盖
    }
    public void delete(Long id){
         userLoveRepository.deleteById(id);
    }
    public List<UserLove> findAll(){
        return userLoveRepository.findAll();
    }
    public UserLove add(UserLove userLove){
        return userLoveRepository.save(userLove);
    }

}
